// 加载框架并新建实例
const fastify = require('fastify')({
    logger: true
})

//setup mongo
fastify.register(require('./plugin/mongo'));
//setup mysql
fastify.register(require("./plugin/mysql"));
//setup redis
fastify.register(require("./plugin/redis"));
// setup elasticsearch
fastify.register(require("./plugin/elasticsearch"));
//路由
fastify.register(require('./router'));


// 启动服务！
fastify.listen(3008,'::', function (err, address) {
    if (err) {
        fastify.log.error(err)
        process.exit(1)
    }
    fastify.log.info(`server listening on ${address}`)
});